import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';

const routes: RouteRecordRaw[] = [
  { path: '/', name: 'Home', component: () => import('@/views/Home.vue'), meta: { title: '首页 - 意数未来｜合肥助贷' } },
  { path: '/about', name: 'About', component: () => import('@/views/About.vue'), meta: { title: '公司简介 - 意数未来｜合肥助贷' } },
  { path: '/services', name: 'Services', component: () => import('@/views/Services.vue'), meta: { title: '产品与服务 - 意数未来｜合肥助贷' } },
  { path: '/contact', name: 'Contact', component: () => import('@/views/Contact.vue'), meta: { title: '联系我们 - 意数未来｜合肥助贷' } }
];

const router = createRouter({
  history: createWebHistory(),
  routes
});

router.afterEach((to) => {
  if (to.meta?.title) document.title = String(to.meta.title);
});

export default router;